//
//  UIView+KY.m
//  KuaiyanCalendar
//
//  Created by 罗新 on 2017/10/17.
//  Copyright © 2017年 KuaiYan  Co.,LTD. All rights reserved.
//

#import "UIView+KY.h"

@implementation UIView (KY)

- (CGFloat)ky_left{
    return self.frame.origin.x;
}

- (void)setKy_left:(CGFloat)x{
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
}

- (CGFloat)ky_top{
    return self.frame.origin.y;
}

- (void)setKy_top:(CGFloat)y{
    CGRect frame = self.frame;
    frame.origin.y = y;
    self.frame = frame;
}

- (CGFloat)ky_right{
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setKy_right:(CGFloat)right{
    CGRect frame = self.frame;
    frame.origin.x = right - frame.size.width;
    self.frame = frame;
}

- (CGFloat)ky_bottom{
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setKy_bottom:(CGFloat)bottom{
    CGRect frame = self.frame;
    frame.origin.y = bottom - frame.size.height;
    self.frame = frame;
}

- (CGFloat)ky_centerX{
    return self.center.x;
}

- (void)setKy_centerX:(CGFloat)centerX{
    self.center = CGPointMake(centerX, self.center.y);
}

- (CGFloat)ky_centerY{
    return self.center.y;
}

- (void)setKy_centerY:(CGFloat)centerY{
    self.center = CGPointMake(self.center.x, centerY);
}

- (CGFloat)ky_width{
    return self.frame.size.width;
}

- (void)setKy_width:(CGFloat)width{
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}

- (CGFloat)ky_height{
    return self.frame.size.height;
}

- (void)setKy_height:(CGFloat)height{
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}

@end
